<!DOCTYPE html>
<html class="x-admin-sm">

<head>
    <meta charset="UTF-8">
    <title>欢迎页面-X-admin2.2</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>-->
    <!--<script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>-->
    <!--<script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>-->
    <!--[endif]-->
    <script type="text/javascript" src="../../common/js/public.js"></script>
    <script type="text/javascript" src="../../common/js/publicUtils.js"></script>
    <style>
        .layui-input-inline,.buttondiv .layui-input-inline {
            float: left;
            width: 450px !important;
            margin-right: 10px;
        }
        .error{
            color: red;
            line-height: 20px;
        }
        .uploadtemp{
            font-size: 14px;
            line-height: 35px;
        }
        #errormsg{
            line-height: 40px;
            font-size: 16px;
            text-align: center;
        }
    </style>
</head>
<body>
<div class="layui-fluid">
    <div class="layui-row">
        <p class="uploadtemp">第一步：下载导入模板，<a href="../../filedown/岗位导入模板.xlsx" style="color:#EB1112">点击下载</a></p>
        <p class="uploadtemp">第二步：选择需要导入的excel文件，导入的excel文件必须按模板填写</p>
        <div class="layui-upload">
            <button type="button" class="layui-btn layui-btn-normal" id="select">选择文件</button>
        </div>
        <p class="uploadtemp">第三步：点击导入按钮导入文件，点击取消按钮侧关闭页面</p>
        <div>
            <button type="button" class="layui-btn" id="upload">开始上传</button>
        </div>
        <p id="errormsg"></p>
    </div>
</div>
<script>

   $(function(){
       layui.use('upload', function() {
           var $ = layui.jquery
               , upload = layui.upload;
           //选完文件后不自动上传
           upload.render({
               elem: '#select'
               ,url: publicUrl+'job/uploadFile'
               ,auto: false
               //,multiple: true
               ,headers:{
                   "Authorization":getData("Authorization")
               }
               ,bindAction: '#upload'
               ,accept: 'file'
               ,exts:'xls|xlsx'//那么，就只会支持这三种格式的上传。注意是用|分割
               ,done: function(res){
                   if(res.code==2000){
                       if(res.data.flag==true){
                           $("#errormsg").html("<span style='color: #00ee00'>导入成功！</span>");
                           loadTable();
                       }else{
                           $("#errormsg").html("<span style='color: red'><a style='color: red' href='"+publicUrl+"common/download/downErrorFile?filename="+res.data.filecode+"&errorname=岗位导入错误文件'>导入失败，点击下载错误文件！</a></span>")
                       }
                   }else{
                       $("#errormsg").html("<span style='color: red'>未知错误，导入失败！</span>");
                   }
               }
           });
       })
   })

    function loadTable(){
        window.parent.loadTable();
    }


</script>
</body>

</html>
